home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / dino / dino_bot.1 / source / shell / newer1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-10  |  1.1 KB  |  51 lines

  1. /* Copyright, 1990, Regents of the University of Colorado */
  2. #define BOOL char
  3. #define TRUE 1
  4. #define FALSE 0
  5. #define MAXNAMESIZE 128
  6.  
  7. #include <stdio.h>
  8. #include <sys/types.h>
  9. #include <sys/stat.h>
  10.  
  11. extern void exit();
  12.  
  13. int main(argc, argv)
  14.     int argc;
  15.     char *argv[];
  16.    {
  17.     struct stat buf1, buf2;
  18.     int I;
  19.     BOOL new = FALSE;
  20.     char filename[MAXNAMESIZE];
  21.  
  22.     if (argc < 6)
  23.        {
  24.         (void) fprintf(stderr, "Incorrect number of arguments to dinochk1.\n");
  25.         exit(1);
  26.        }
  27.  
  28.     if (stat(argv[1], &buf1) != 0)
  29.        {
  30.         (void) fprintf(stderr, "dinochk1 unable to access %s.\n", argv[1]);
  31.         exit(1);
  32.        }
  33.  
  34.     if (strcmp(argv[2], "new") == 0)
  35.         new = TRUE;
  36.  
  37.     for (I = 5; I < argc; I++)
  38.        {
  39.         if (new)
  40.             (void) sprintf(filename, "%s.%s.%s.c", argv[3], argv[4], argv[I]);
  41.         else
  42.             (void) sprintf(filename, "%s%s.c", argv[I], argv[4]);
  43.         if (stat(filename, &buf2) != 0)
  44.             exit(1);
  45.         if (buf1.st_mtime > buf2.st_mtime)
  46.             exit(1);
  47.        }
  48.     return(0);
  49.    }
  50.  
  51.